import { Component, OnInit, ChangeDetectorRef, ViewChild } from '@angular/core';
import { masterService } from '../../../../lib/master.service';
import { VoucherBatchCreateComponent } from './create/create.component';
import { GridComponent } from './list/grid.component';

@Component({
    selector: 'voucher-management',
    templateUrl: './voucher-batch-to-user.component.html',
    styleUrls: ['./voucher-batch-to-user.component.css'],
    providers: [masterService]
})
export class VoucherBatchToUserComponent implements OnInit {
    @ViewChild('voucherBatchAdd') voucherBatchAdd: VoucherBatchCreateComponent;
    @ViewChild('gridBatch') gridBatch: GridComponent;

    ngOnInit() { }
    
        openModal() {
            this.voucherBatchAdd.newVoucherBatch.show();
        }
    
        public filter: any = {
            itemsPerPage: '10',
            page: '1'
        }
    
        constructor(private _masterService: masterService,
                    private cdRef: ChangeDetectorRef) { }
    
        // 新建确认后触发
        changeVoucherBatchList() {
            this.gridBatch.onChangeTable(this.filter);
        }
}
